﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.ComponentModel;

namespace SiteRecord
{
    public static class Utility
    {
        public static string SearchEngineUrl = Properties.Resources.SearchEngine;
        public static string Prefix = Properties.Resources.Prefix;

        /// <summary>
        /// 通用扩展 为空字符串
        /// </summary>
        public static string EToString(this object str)
        {
            return str == null ? string.Empty : str.ToString();
        }

        /// <summary>
        /// 移除所有空格
        /// </summary>
        public static string RemoveAllEmptyStr(this string str)
        {
            return str.Replace(" ", "");
        }

        public static void Crawl(this Users user)
        {
            UserEngine.Crawl(user);
        }


        public static bool IsNullOrEmpty(this object str)
        {
            return string.IsNullOrEmpty(str.EToString());
        }


        public static void RegisterScript(this Page page, string script)
        {
            page.ClientScript.RegisterClientScriptBlock(page.GetType(), "RegisterClientScriptBlock", script, true);
        }

    }
}